<html>
<head>
<title>异想之旅聊天</title>
</head>
<body>
发送信息：
<table border="0">
<tr>
  <td><input type="text" id="outname" placeholder="发件人"></td>
  <td><input type="text" id="outpswd" placeholder="发件人密码"></td>
</tr>
<tr>
  <td><input type="text" id="inname" placeholder="收件人"></td>
  <td><button id="send" type="button">发送</button></td>
</tr>
<tr>
  <td colspan=2><textarea style="width:100%;height:200px" type="text" id="outt" placeholder="正文"></textarea></td>
</tr>
</table>

<script type="text/javascript" src="https://s3.pstatp.com/cdn/expire-1-M/jquery/3.3.1/jquery.min.js"></script>
<script>
$('#send').on('click',function(){
    var data = {
    "outname": document.getElementById("outname").value,
    "outpswd": document.getElementById("outpswd").value,
    "inname": document.getElementById("inname").value,
    "t": document.getElementById("outt").value,
    };
    
    $.ajax({
    type: 'post',
    url: "/send",
    data: JSON.stringify(data), 
    contentType: 'application/json; charset=UTF-8',
    dataType: 'text', 
    success: function(data) {
         alert(data);
    },
    error: function(xhr, type) {alert(type);}
    });
    //location.reload();
});
</script>
</body>
</html>